home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 2 / AACD 2.iso / AACD / Graphics / ImageFX / SaveBufferTIFF / Rexx / AutoFX / SaveBufferAs_TIFF.ifx next >
Encoding:
Text File  |  1999-05-06  |  1.4 KB  |  66 lines

  1. /*
  2.  * $VER: SaveBufferAs_TIFF.ifx
  3.  * Modified by dhomas trenn (01 Mar 1999)
  4.  * -> Modified to support TIFF images
  5.  * -> CHANGES extension to 'New Extension' (rather than appending it)
  6.  *
  7.  * Copyright © 1992-1996 Nova Design, Inc.
  8.  * Written by Thomas Krehbiel
  9.  *
  10.  * Save main buffer as TIFF.
  11.  *
  12.  * Inputs:
  13.  *    Word(Arg(1),1) = Frame number (1 - N)
  14.  *    Word(Arg(1),2) = Main filename ("-" if not specified)
  15.  *    Word(Arg(1),3) = Swap filename ("-" if not specified)
  16.  *    Word(Arg(1),4) = Sequence number (?)
  17.  *    Word(Arg(1),5) = Total number of frames (N)
  18.  *
  19.  */
  20.  
  21. options results
  22.  
  23. framenum = Word(Arg(1),1)
  24. mainname = Word(Arg(1),2)
  25. swapname = Word(Arg(1),3)
  26. seq      = Word(Arg(1),4)
  27. framemax = Word(Arg(1),5)
  28.  
  29. base = 'Autofx_SaveBufferAsTIFF_'
  30.  
  31. path = getclip(base'Path'seq)
  32. ext  = getclip(base'Ext'seq)
  33. lzw  = getclip(base'LZW'seq)
  34.  
  35. /* gracefully exit if no buffer */
  36. GetMain
  37. if rc ~= 0 then exit 0
  38.  
  39. i = pos('*', ext)
  40. if i > 0 then ext = left(ext,i-1) || right('00000'||framenum,5) || substr(ext,i+1)
  41.  
  42. i = lastpos('.', mainname)
  43. if i > 0 then mainname = left(mainname, i-1)
  44.  
  45. outfile = mainname||ext
  46. if path ~= "" then do
  47.     i = lastpos('/',mainname)
  48.     if i = 0 then i = lastpos(':',mainname)
  49.     if i = 0 then
  50.         file = mainname
  51.     else
  52.         file = substr(mainname,i+1)
  53.  
  54.     if right(path,1) ~= ':' then path = path||'/'
  55.     outfile = path||file||ext
  56. end
  57.  
  58. if lzw = "1" then
  59.     lzw = "LZW"
  60. else
  61.     lzw = "NoCompress"
  62.  
  63.  
  64. SaveBufferAs TIFF '"'outfile'"' lzw
  65. exit rc
  66.